package com.whfc.ms.api.constlog.controller;

import com.whfc.common.base.BaseController;
import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.common.util.SessionAttr;
import com.whfc.fuum.entity.SysUser;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.Date;

/**
 * @author: hw
 * @date: 2021-10-29 14:41
 * @description: 施工日报
 */
@RestController
@RequestMapping("/ms/api/const")
public class MsConstRecordController extends BaseController {

    @GetMapping("record/summary")
    public Result recordSummary(@SessionAttribute(SessionAttr.MS_USER) SysUser user, @RequestParam("deptId") Integer deptId,
                                @RequestParam(value = "time", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date time) {
        logger.info("施工记录汇总,loginUser:{}, deptId:{}，time：{}", user.getUsername(), deptId, time);
        return ResultUtil.success();
    }


    @GetMapping("record/list")
    public Result recordList(@SessionAttribute(SessionAttr.MS_USER) SysUser user, @RequestParam("deptId") Integer deptId,
                             @RequestParam(value = "time", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date time,
                             @RequestParam(value = "pageNum") Integer pageNum,
                             @RequestParam(value = "pageSize") Integer pageSize) {
        logger.info("施工记录列表,loginUser:{}, deptId:{}，time：{},pageNum:{},pageSize:{}", user.getUsername(), deptId, time, pageNum, pageSize);
        return ResultUtil.success(Collections.emptyList());
    }

    @GetMapping("outside/details")
    public Result outsideDetails(@SessionAttribute(SessionAttr.MS_USER) SysUser user, @RequestParam("deptId") Integer deptId,
                                 @RequestParam(value = "time", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date time) {
        logger.info("外界检查详情,loginUser:{}, deptId:{}，time：{}", user.getUsername(), deptId, time);
        return ResultUtil.success();
    }

    @GetMapping("export")
    public Result export(@SessionAttribute(SessionAttr.MS_USER) SysUser user, @RequestParam("deptId") Integer deptId,
                         @RequestParam(value = "time", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date time) {
        logger.info("导出施工日志,loginUser:{}, deptId:{}，time：{}", user.getUsername(), deptId, time);
        return ResultUtil.success();
    }
}
